home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsICookiePermission.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  202 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsICookiePermission.idl
  3.  */
  4.  
  5. #ifndef __gen_nsICookiePermission_h__
  6. #define __gen_nsICookiePermission_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsICookie2; /* forward declaration */
  18.  
  19. class nsIURI; /* forward declaration */
  20.  
  21. class nsIChannel; /* forward declaration */
  22.  
  23. typedef PRInt32 nsCookieAccess;
  24.  
  25.  
  26. /* starting interface:    nsICookiePermission */
  27. #define NS_ICOOKIEPERMISSION_IID_STR "91f1c3ec-73a0-4bf0-bdc5-348a1f181b0e"
  28.  
  29. #define NS_ICOOKIEPERMISSION_IID \
  30.   {0x91f1c3ec, 0x73a0, 0x4bf0, \
  31.     { 0xbd, 0xc5, 0x34, 0x8a, 0x1f, 0x18, 0x1b, 0x0e }}
  32.  
  33. /**
  34.  * An interface to test for cookie permissions
  35.  */
  36. class NS_NO_VTABLE nsICookiePermission : public nsISupports {
  37.  public: 
  38.  
  39.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOOKIEPERMISSION_IID)
  40.  
  41.   /**
  42.    * nsCookieAccess values
  43.    */
  44.   enum { ACCESS_DEFAULT = 0 };
  45.  
  46.   enum { ACCESS_ALLOW = 1 };
  47.  
  48.   enum { ACCESS_DENY = 2 };
  49.  
  50.   /**
  51.    * additional values for nsCookieAccess, which are not directly used by
  52.    * any methods on this interface, but are nevertheless convenient to define
  53.    * here. these may be relocated somewhere else if we ever consider freezing
  54.    * this interface.
  55.    */
  56.   enum { ACCESS_SESSION = 8 };
  57.  
  58.   /**
  59.    * setAccess
  60.    *
  61.    * this method is called to block cookie access for the given URI.  this
  62.    * may result in other URIs being blocked as well (e.g., URIs which share
  63.    * the same host name).
  64.    *
  65.    * @param aURI
  66.    *        the URI to block
  67.    * @param aAccess
  68.    *        the new cookie access for the URI.
  69.    */
  70.   /* void setAccess (in nsIURI aURI, in nsCookieAccess aAccess); */
  71.   NS_IMETHOD SetAccess(nsIURI *aURI, nsCookieAccess aAccess) = 0;
  72.  
  73.   /**
  74.    * canAccess
  75.    *
  76.    * this method is called to test whether or not the given URI/channel may
  77.    * access the cookie database, either to set or get cookies.
  78.    *
  79.    * @param aURI
  80.    *        the URI trying to access cookies
  81.    * @param aFirstURI
  82.    *        the URI initiated by the user that resulted in aURI being loaded
  83.    * @param aChannel
  84.    *        the channel corresponding to aURI
  85.    *
  86.    * @return one of the following nsCookieAccess values:
  87.    *         ACCESS_DEFAULT, ACCESS_ALLOW, or ACCESS_DENY
  88.    */
  89.   /* nsCookieAccess canAccess (in nsIURI aURI, in nsIURI aFirstURI, in nsIChannel aChannel); */
  90.   NS_IMETHOD CanAccess(nsIURI *aURI, nsIURI *aFirstURI, nsIChannel *aChannel, nsCookieAccess *_retval) = 0;
  91.  
  92.   /**
  93.    * canSetCookie
  94.    *
  95.    * this method is called to test whether or not the given URI/channel may
  96.    * set a specific cookie.  this method is always preceded by a call to
  97.    * canAccess. it may modify the isSession and expiry attributes of the
  98.    * cookie via the aIsSession and aExpiry parameters, in order to limit
  99.    * or extend the lifetime of the cookie. this is useful, for instance, to
  100.    * downgrade a cookie to session-only if it fails to meet certain criteria.
  101.    *
  102.    * @param aURI
  103.    *        the URI trying to set the cookie
  104.    * @param aChannel
  105.    *        the corresponding to aURI
  106.    * @param aCookie
  107.    *        the cookie being added to the cookie database
  108.    * @param aIsSession
  109.    *        when canSetCookie is invoked, this is the current isSession attribute
  110.    *        of the cookie. canSetCookie may leave this value unchanged to
  111.    *        preserve this attribute of the cookie.
  112.    * @param aExpiry
  113.    *        when canSetCookie is invoked, this is the current expiry time of
  114.    *        the cookie. canSetCookie may leave this value unchanged to
  115.    *        preserve this attribute of the cookie.
  116.    *
  117.    * @return true if the cookie can be set.
  118.    */
  119.   /* boolean canSetCookie (in nsIURI aURI, in nsIChannel aChannel, in nsICookie2 aCookie, inout boolean aIsSession, inout PRInt64 aExpiry); */
  120.   NS_IMETHOD CanSetCookie(nsIURI *aURI, nsIChannel *aChannel, nsICookie2 *aCookie, PRBool *aIsSession, PRInt64 *aExpiry, PRBool *_retval) = 0;
  121.  
  122. };
  123.  
  124. /* Use this macro when declaring classes that implement this interface. */
  125. #define NS_DECL_NSICOOKIEPERMISSION \
  126.   NS_IMETHOD SetAccess(nsIURI *aURI, nsCookieAccess aAccess); \
  127.   NS_IMETHOD CanAccess(nsIURI *aURI, nsIURI *aFirstURI, nsIChannel *aChannel, nsCookieAccess *_retval); \
  128.   NS_IMETHOD CanSetCookie(nsIURI *aURI, nsIChannel *aChannel, nsICookie2 *aCookie, PRBool *aIsSession, PRInt64 *aExpiry, PRBool *_retval); 
  129.  
  130. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  131. #define NS_FORWARD_NSICOOKIEPERMISSION(_to) \
  132.   NS_IMETHOD SetAccess(nsIURI *aURI, nsCookieAccess aAccess) { return _to SetAccess(aURI, aAccess); } \
  133.   NS_IMETHOD CanAccess(nsIURI *aURI, nsIURI *aFirstURI, nsIChannel *aChannel, nsCookieAccess *_retval) { return _to CanAccess(aURI, aFirstURI, aChannel, _retval); } \
  134.   NS_IMETHOD CanSetCookie(nsIURI *aURI, nsIChannel *aChannel, nsICookie2 *aCookie, PRBool *aIsSession, PRInt64 *aExpiry, PRBool *_retval) { return _to CanSetCookie(aURI, aChannel, aCookie, aIsSession, aExpiry, _retval); } 
  135.  
  136. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  137. #define NS_FORWARD_SAFE_NSICOOKIEPERMISSION(_to) \
  138.   NS_IMETHOD SetAccess(nsIURI *aURI, nsCookieAccess aAccess) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAccess(aURI, aAccess); } \
  139.   NS_IMETHOD CanAccess(nsIURI *aURI, nsIURI *aFirstURI, nsIChannel *aChannel, nsCookieAccess *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanAccess(aURI, aFirstURI, aChannel, _retval); } \
  140.   NS_IMETHOD CanSetCookie(nsIURI *aURI, nsIChannel *aChannel, nsICookie2 *aCookie, PRBool *aIsSession, PRInt64 *aExpiry, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanSetCookie(aURI, aChannel, aCookie, aIsSession, aExpiry, _retval); } 
  141.  
  142. #if 0
  143. /* Use the code below as a template for the implementation class for this interface. */
  144.  
  145. /* Header file */
  146. class nsCookiePermission : public nsICookiePermission
  147. {
  148. public:
  149.   NS_DECL_ISUPPORTS
  150.   NS_DECL_NSICOOKIEPERMISSION
  151.  
  152.   nsCookiePermission();
  153.  
  154. private:
  155.   ~nsCookiePermission();
  156.  
  157. protected:
  158.   /* additional members */
  159. };
  160.  
  161. /* Implementation file */
  162. NS_IMPL_ISUPPORTS1(nsCookiePermission, nsICookiePermission)
  163.  
  164. nsCookiePermission::nsCookiePermission()
  165. {
  166.   /* member initializers and constructor code */
  167. }
  168.  
  169. nsCookiePermission::~nsCookiePermission()
  170. {
  171.   /* destructor code */
  172. }
  173.  
  174. /* void setAccess (in nsIURI aURI, in nsCookieAccess aAccess); */
  175. NS_IMETHODIMP nsCookiePermission::SetAccess(nsIURI *aURI, nsCookieAccess aAccess)
  176. {
  177.     return NS_ERROR_NOT_IMPLEMENTED;
  178. }
  179.  
  180. /* nsCookieAccess canAccess (in nsIURI aURI, in nsIURI aFirstURI, in nsIChannel aChannel); */
  181. NS_IMETHODIMP nsCookiePermission::CanAccess(nsIURI *aURI, nsIURI *aFirstURI, nsIChannel *aChannel, nsCookieAccess *_retval)
  182. {
  183.     return NS_ERROR_NOT_IMPLEMENTED;
  184. }
  185.  
  186. /* boolean canSetCookie (in nsIURI aURI, in nsIChannel aChannel, in nsICookie2 aCookie, inout boolean aIsSession, inout PRInt64 aExpiry); */
  187. NS_IMETHODIMP nsCookiePermission::CanSetCookie(nsIURI *aURI, nsIChannel *aChannel, nsICookie2 *aCookie, PRBool *aIsSession, PRInt64 *aExpiry, PRBool *_retval)
  188. {
  189.     return NS_ERROR_NOT_IMPLEMENTED;
  190. }
  191.  
  192. /* End of implementation class template. */
  193. #endif
  194.  
  195. /**
  196.  * The nsICookiePermission implementation is an XPCOM service registered
  197.  * under the ContractID:
  198.  */
  199. #define NS_COOKIEPERMISSION_CONTRACTID "@mozilla.org/cookie/permission;1"
  200.  
  201. #endif /* __gen_nsICookiePermission_h__ */
  202.